﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Collections;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI.WebControls;
using System.Web.UI;
using System.Web.UI.HtmlControls;

/// <summary>
///MyTemplate 的摘要说明
/// </summary>
    public class DataGridTemplate : ITemplate
{
    ListItemType templateType;
    string columnName;

    public DataGridTemplate(ListItemType type ,  string cname)
    {
        templateType = type;
        columnName = cname;
    }
    public void InstantiateIn(System.Web.UI.Control container)
    {
        Literal lc = new Literal();
        switch(templateType)
        {
            case ListItemType.Header:
                lc.Text = "<B>" + columnName + "</B>";
                container.Controls.Add(lc);
                break;
            case ListItemType.Item:
                if(columnName == "myCol")
                {
                    Button btn = new Button();
                    btn.Text = "下载";
                    btn.OnClientClick = "btn_Click";
                    container.Controls.Add(btn);
                }
               
                break;
         
        }
    }
}
